import { defineStore } from 'pinia'
import { ref } from 'vue'

//api请求模块
export const useApiStore = defineStore('api-request',()=>{
        const access_token = ref('')
        const api_key = ref('')

        const setAcccessToken = (newAcccessToken) => {
            access_token.value = newAcccessToken;
        }

        const removeAcccessToken = (newAcccessToken) => {
            access_token.value = '';
        }

        const setApikey = (newApikey) => {
            api_key.value = newApikey;
        }
        const removeApikey = (newAcccessToken) => {
            api_key.value = '';
        }

        return {
            access_token,
            setAcccessToken,
            removeAcccessToken,
            api_key,
            setApikey,
            removeApikey
        }
    },{
        persist: true
    }
)